home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / gas / gassrc04.zoo / i386-opcode.h < prev    next >
Text File  |  1991-01-24  |  30KB  |  798 lines

  1. /* i386-opcode.h -- Intel 80386 opcode table
  2.    Copyright (C) 1989, Free Software Foundation.
  3.  
  4. This file is part of GAS, the GNU Assembler.
  5.  
  6. GAS is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GAS is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GAS; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.    
  20. template i386_optab[] = {
  21.  
  22. #define _ None
  23. /* move instructions */
  24. { "mov", 2, 0xa0, _, DW|NoModrm, Disp32, Acc, 0 },
  25. { "mov", 2, 0x88, _, DW|Modrm, Reg, Reg|Mem, 0 },
  26. { "mov", 2, 0xb0, _, ShortFormW, Imm, Reg, 0 },
  27. { "mov", 2, 0xc6, _,  W|Modrm,  Imm, Reg|Mem, 0 },
  28. { "mov", 2, 0x8c, _, D|Modrm,  SReg3|SReg2, Reg16|Mem16, 0 },
  29. /* move to/from control debug registers */
  30. { "mov", 2, 0x0f20, _, D|Modrm, Control, Reg32, 0},
  31. { "mov", 2, 0x0f21, _, D|Modrm, Debug, Reg32, 0},
  32. { "mov", 2, 0x0f24, _, D|Modrm, Test, Reg32, 0},
  33.  
  34. /* move with sign extend */
  35. /* "movsbl" & "movsbw" must not be unified into "movsb" to avoid
  36.    conflict with the "movs" string move instruction.  Thus,
  37.    {"movsb", 2, 0x0fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem,  Reg16|Reg32, 0},
  38.    is not kosher; we must seperate the two instructions. */
  39. {"movsbl", 2, 0x0fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem,  Reg32, 0},
  40. {"movsbw", 2, 0x660fbe, _, ReverseRegRegmem|Modrm, Reg8|Mem,  Reg16, 0},
  41. {"movswl", 2, 0x0fbf, _, ReverseRegRegmem|Modrm, Reg16|Mem, Reg32, 0},
  42.  
  43. /* move with zero extend */
  44. {"movzb", 2, 0x0fb6, _, ReverseRegRegmem|Modrm, Reg8|Mem, Reg16|Reg32, 0},
  45. {"movzwl", 2, 0x0fb7, _, ReverseRegRegmem|Modrm, Reg16|Mem, Reg32, 0},
  46.  
  47. /* push instructions */
  48. {"push", 1, 0x50, _, ShortForm, WordReg,0,0 },
  49. {"push", 1, 0xff, 0x6,  Modrm, WordReg|WordMem, 0, 0 },
  50. {"push", 1, 0x6a, _, NoModrm, Imm8S, 0, 0},
  51. {"push", 1, 0x68, _, NoModrm, Imm32, 0, 0},
  52. {"push", 1, 0x06, _,  Seg2ShortForm, SReg2,0,0 },
  53. {"push", 1, 0x0fa0, _, Seg3ShortForm, SReg3,0,0 },
  54. /* push all */
  55. {"pusha", 0, 0x60, _, NoModrm, 0, 0, 0 },
  56.  
  57. /* pop instructions */
  58. {"pop", 1, 0x58, _, ShortForm, WordReg,0,0 },
  59. {"pop", 1, 0x8f, 0x0,  Modrm, WordReg|WordMem, 0, 0 },
  60. #define POP_SEG_SHORT 0x7
  61. {"pop", 1, 0x07, _,  Seg2ShortForm, SReg2,0,0 },
  62. {"pop", 1, 0x0fa1, _, Seg3ShortForm, SReg3,0,0 },
  63. /* pop all */
  64. {"popa", 0, 0x61, _, NoModrm, 0, 0, 0 },
  65.  
  66. /* xchg exchange instructions
  67.    xchg commutes:  we allow both operand orders */
  68. {"xchg", 2, 0x90, _, ShortForm, WordReg, Acc, 0 },
  69. {"xchg", 2, 0x90, _, ShortForm, Acc, WordReg, 0 },
  70. {"xchg", 2, 0x86, _, W|Modrm, Reg, Reg|Mem, 0 },
  71. {"xchg", 2, 0x86, _, W|Modrm, Reg|Mem, Reg, 0 },
  72.  
  73. /* in/out from ports */
  74. {"in", 2, 0xe4, _, W|NoModrm, Imm8, Acc, 0 },
  75. {"in", 2, 0xec, _, W|NoModrm, InOutPortReg, Acc, 0 },
  76. {"out", 2, 0xe6, _, W|NoModrm, Acc, Imm8, 0 },
  77. {"out", 2, 0xee, _, W|NoModrm, Acc, InOutPortReg, 0 },
  78.  
  79. /* load effective address */
  80. {"lea", 2, 0x8d, _, Modrm, WordMem, WordReg, 0 },
  81.  
  82. /* load segment registers from memory */
  83. {"lds", 2, 0xc5, _, Modrm, Mem, Reg32, 0},
  84. {"les", 2, 0xc4, _, Modrm, Mem, Reg32, 0},
  85. {"lfs", 2, 0x0fb4, _, Modrm, Mem, Reg32, 0},
  86. {"lgs", 2, 0x0fb5, _, Modrm, Mem, Reg32, 0},
  87. {"lss", 2, 0x0fb2, _, Modrm, Mem, Reg32, 0},
  88.  
  89. /* flags register instructions */
  90. {"clc", 0, 0xf8, _, NoModrm, 0, 0, 0},
  91. {"cld", 0, 0xfc, _, NoModrm, 0, 0, 0},
  92. {"cli", 0, 0xfa, _, NoModrm, 0, 0, 0},
  93. {"clts", 0, 0x0f06, _, NoModrm, 0, 0, 0},
  94. {"cmc", 0, 0xf5, _, NoModrm, 0, 0, 0},
  95. {"lahf", 0, 0x9f, _, NoModrm, 0, 0, 0},
  96. {"sahf", 0, 0x9e, _, NoModrm, 0, 0, 0},
  97. {"pushf", 0, 0x9c, _, NoModrm, 0, 0, 0},
  98. {"popf", 0, 0x9d, _, NoModrm, 0, 0, 0},
  99. {"stc", 0, 0xf9, _, NoModrm, 0, 0, 0},
  100. {"std", 0, 0xfd, _, NoModrm, 0, 0, 0},
  101. {"sti", 0, 0xfb, _, NoModrm, 0, 0, 0},
  102.  
  103. {"add", 2, 0x0,  _, DW|Modrm, Reg, Reg|Mem, 0},
  104. {"add", 2, 0x83, 0,  Modrm, Imm8S, WordReg|WordMem, 0},
  105. {"add", 2, 0x4,  _,  W|NoModrm, Imm,  Acc,    0},
  106. {"add", 2, 0x80, 0, W|Modrm, Imm, Reg|Mem, 0},
  107.  
  108. {"inc", 1, 0x40, _, ShortForm, WordReg, 0, 0},
  109. {"inc", 1, 0xfe, 0, W|Modrm, Reg|Mem, 0, 0},
  110.  
  111. {"sub", 2, 0x28,  _, DW|Modrm, Reg, Reg|Mem, 0},
  112. {"sub", 2, 0x83, 5,  Modrm, Imm8S, WordReg|WordMem, 0},
  113. {"sub", 2, 0x2c,  _,  W|NoModrm, Imm,  Acc,    0},
  114. {"sub", 2, 0x80, 5,  W|Modrm, Imm, Reg|Mem, 0},
  115.  
  116. {"dec", 1, 0x48, _, ShortForm, WordReg, 0, 0},
  117. {"dec", 1, 0xfe, 1, W|Modrm, Reg|Mem, 0, 0},
  118.  
  119. {"sbb", 2, 0x18,  _, DW|Modrm, Reg, Reg|Mem, 0},
  120. {"sbb", 2, 0x83, 3,  Modrm, Imm8S, WordReg|WordMem, 0},
  121. {"sbb", 2, 0x1c,  _,  W|NoModrm, Imm,  Acc,    0},
  122. {"sbb", 2, 0x80, 3,  W|Modrm, Imm, Reg|Mem, 0},
  123.  
  124. {"cmp", 2, 0x38,  _, DW|Modrm, Reg, Reg|Mem, 0},
  125. {"cmp", 2, 0x83, 7,  Modrm, Imm8S, WordReg|WordMem, 0},
  126. {"cmp", 2, 0x3c,  _,  W|NoModrm, Imm,  Acc,    0},
  127. {"cmp", 2, 0x80, 7,  W|Modrm, Imm, Reg|Mem, 0},
  128.  
  129. {"test", 2, 0x84, _, W|Modrm, Reg|Mem, Reg, 0},
  130. {"test", 2, 0x84, _, W|Modrm, Reg, Reg|Mem, 0},
  131. {"test", 2, 0xa8, _, W|NoModrm, Imm, Acc, 0},
  132. {"test", 2, 0xf6, 0, W|Modrm, Imm, Reg|Mem, 0},
  133.  
  134. {"and", 2, 0x20,  _, DW|Modrm, Reg, Reg|Mem, 0},
  135. {"and", 2, 0x83, 4,  Modrm, Imm8S, WordReg|WordMem, 0},
  136. {"and", 2, 0x24,  _,  W|NoModrm, Imm,  Acc,    0},
  137. {"and", 2, 0x80, 4,  W|Modrm, Imm, Reg|Mem, 0},
  138.  
  139. {"or", 2, 0x08,  _, DW|Modrm, Reg, Reg|Mem, 0},
  140. {"or", 2, 0x83, 1,  Modrm, Imm8S, WordReg|WordMem, 0},
  141. {"or", 2, 0x0c,  _,  W|NoModrm, Imm,  Acc,    0},
  142. {"or", 2, 0x80, 1,  W|Modrm, Imm, Reg|Mem, 0},
  143.  
  144. {"xor", 2, 0x30,  _, DW|Modrm, Reg, Reg|Mem, 0},
  145. {"xor", 2, 0x83, 6,  Modrm, Imm8S, WordReg|WordMem, 0},
  146. {"xor", 2, 0x34,  _,  W|NoModrm, Imm,  Acc,    0},
  147. {"xor", 2, 0x80, 6,  W|Modrm, Imm, Reg|Mem, 0},
  148.  
  149. {"adc", 2, 0x10,  _, DW|Modrm, Reg, Reg|Mem, 0},
  150. {"adc", 2, 0x83, 2,  Modrm, Imm8S, WordReg|WordMem, 0},
  151. {"adc", 2, 0x14,  _,  W|NoModrm, Imm,  Acc,    0},
  152. {"adc", 2, 0x80, 2,  W|Modrm, Imm, Reg|Mem, 0},
  153.  
  154. {"neg", 1, 0xf6, 3, W|Modrm, Reg|Mem, 0, 0},
  155. {"not", 1, 0xf6, 2, W|Modrm, Reg|Mem, 0, 0},
  156.  
  157. {"aaa", 0, 0x37, _, NoModrm, 0, 0, 0},
  158. {"aas", 0, 0x3f, _, NoModrm, 0, 0, 0},
  159. {"daa", 0, 0x27, _, NoModrm, 0, 0, 0},
  160. {"das", 0, 0x2f, _, NoModrm, 0, 0, 0},
  161. {"aad", 0, 0xd50a, _, NoModrm, 0, 0, 0},
  162. {"aam", 0, 0xd40a, _, NoModrm, 0, 0, 0},
  163.  
  164. /* conversion insns */
  165. /* conversion:  intel naming */
  166. {"cbw", 0, 0x6698, _, NoModrm, 0, 0, 0},
  167. {"cwd", 0, 0x6699, _, NoModrm, 0, 0, 0},
  168. {"cwde", 0, 0x98, _, NoModrm, 0, 0, 0},
  169. {"cdq", 0, 0x99, _, NoModrm, 0, 0, 0},
  170. /*  att naming */
  171. {"cbtw", 0, 0x6698, _, NoModrm, 0, 0, 0},
  172. {"cwtl", 0, 0x98, _, NoModrm, 0, 0, 0},
  173. {"cwtd", 0, 0x6699, _, NoModrm, 0, 0, 0},
  174. {"cltd", 0, 0x99, _, NoModrm, 0, 0, 0},
  175.  
  176. /* Warning! the mul/imul (opcode 0xf6) must only have 1 operand!  They are
  177.    expanding 64-bit multiplies, and *cannot* be selected to accomplish
  178.    'imul %ebx, %eax' (opcode 0x0faf must be used in this case)
  179.    These multiplies can only be selected with single opearnd forms. */
  180. {"mul",  1, 0xf6, 4, W|Modrm, Reg|Mem, 0, 0},
  181. {"imul", 1, 0xf6, 5, W|Modrm, Reg|Mem, 0, 0},
  182.  
  183.  
  184.  
  185.  
  186. /* imulKludge here is needed to reverse the i.rm.reg & i.rm.regmem fields.
  187.    These instructions are exceptions:  'imul $2, %eax, %ecx' would put
  188.    '%eax' in the reg field and '%ecx' in the regmem field if we did not
  189.    switch them. */
  190. {"imul", 2, 0x0faf, _, Modrm|ReverseRegRegmem, WordReg|Mem, WordReg, 0},
  191. {"imul", 3, 0x6b, _, Modrm|ReverseRegRegmem, Imm8S, WordReg|Mem, WordReg},
  192. {"imul", 3, 0x69, _, Modrm|ReverseRegRegmem, Imm16|Imm32, WordReg|Mem, WordReg},
  193. /*
  194.   imul with 2 operands mimicks imul with 3 by puting register both
  195.   in i.rm.reg & i.rm.regmem fields
  196. */
  197. {"imul", 2, 0x6b, _, Modrm|imulKludge, Imm8S, WordReg, 0},
  198. {"imul", 2, 0x69, _, Modrm|imulKludge, Imm16|Imm32, WordReg, 0},
  199. {"div", 1, 0xf6, 6, W|Modrm, Reg|Mem, 0, 0},
  200. {"div", 2, 0xf6, 6, W|Modrm, Reg|Mem, Acc, 0},
  201. {"idiv", 1, 0xf6, 7, W|Modrm, Reg|Mem, 0, 0},
  202. {"idiv", 2, 0xf6, 7, W|Modrm, Reg|Mem, Acc, 0},
  203.  
  204. {"rol", 2, 0xd0, 0, W|Modrm, Imm1, Reg|Mem, 0},
  205. {"rol", 2, 0xc0, 0, W|Modrm, Imm8, Reg|Mem, 0},
  206. {"rol", 2, 0xd2, 0, W|Modrm, ShiftCount, Reg|Mem, 0},
  207. {"rol", 1,